#include "Main.h"

byte* ctargetPtr;
byte* ctargetMonsterPtr;

void CTarget::Init()
{
	__try {
		ctargetPtr = (byte*)(*(dword*)Mem->GetAddress("CTargetPtr"));
		ctargetMonsterPtr = ctargetPtr + 0x9BA0;
	}
	__except(1) { }
}

long CTarget::GetCurrentTargetId()
{
	long retVal = 0;

	if(!ctargetPtr)
		return NULL;

	__try {
		if(*(long*)(ctargetMonsterPtr) != -1)
			retVal = *(long*)(ctargetMonsterPtr);
		else if(*(long*)(ctargetPtr + 0x9B98) != -1)
			retVal = *(long*)(ctargetPtr + 0x9B98);
	}
	__except(1) { }

	return retVal;
}